package com.burstly.lib.component.networkcomponent.burstly.html.mraid;

import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

final class JavascriptEventFactory
{
  private final String mBridgeName;

  JavascriptEventFactory(String paramString)
  {
    this.mBridgeName = paramString;
  }

  String createChangeEvent(Map<String, Object> paramMap)
  {
    StringBuilder localStringBuilder = new StringBuilder(this.mBridgeName);
    localStringBuilder.append(".fireChangeEvent({");
    Iterator localIterator = paramMap.entrySet().iterator();
    if (localIterator.hasNext())
    {
      Map.Entry localEntry = (Map.Entry)localIterator.next();
      String str = localEntry.getValue().toString();
      localStringBuilder.append((String)localEntry.getKey()).append(": ");
      if (!str.startsWith("{"));
      for (int i = 1; ; i = 0)
      {
        if (i != 0)
          localStringBuilder.append("'");
        localStringBuilder.append(str);
        if (i != 0)
          localStringBuilder.append("'");
        if (!localIterator.hasNext())
          break;
        localStringBuilder.append(",");
        break;
      }
    }
    localStringBuilder.append("});");
    return localStringBuilder.toString();
  }

  String createErrorEvent(String paramString1, String paramString2)
  {
    return this.mBridgeName + ".fireErrorEvent('" + paramString2 + "','" + paramString1 + "');";
  }

  String createReadyEvent()
  {
    return this.mBridgeName + ".fireReadyEvent();";
  }

  String createSimpleChangeEvent(String paramString, Object paramObject)
  {
    StringBuilder localStringBuilder = new StringBuilder(this.mBridgeName);
    localStringBuilder.append(".fireChangeEvent({").append(paramString).append(":");
    if (!paramObject.toString().startsWith("{"));
    for (int i = 1; ; i = 0)
    {
      if (i != 0)
        localStringBuilder.append("'");
      localStringBuilder.append(paramObject);
      if (i != 0)
        localStringBuilder.append("'");
      localStringBuilder.append("});");
      return localStringBuilder.toString();
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.burstly.lib.component.networkcomponent.burstly.html.mraid.JavascriptEventFactory
 * JD-Core Version:    0.6.2
 */